package com.controller.setting;

import com.comm.R;
import com.comm.vo.DrugTableVo;
import com.service.setting.SystemDrugService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@RequestMapping(value = "/setting/systemDrug")
@Controller
@Api(value = "药品字典表",tags = "药品字典表接口")
@ApiResponses({
        @ApiResponse(code=200,message="请求成功"),
        @ApiResponse(code=404,message="找不到页面"),
        @ApiResponse(code=403,message="请求禁止"),
        @ApiResponse(code=401,message="请求未授权"),
        @ApiResponse(code=500,message="后台服务错误")})



public class SystemDrug {

    @Autowired
    private SystemDrugService drugService;
    //1.4.1：查找所有的药品字典表
    @ResponseBody
    @RequestMapping(value ="/fundDrugs",method = RequestMethod.GET)
    @ApiOperation(value = "查找所有的药品字典表的接口",notes = "查找所有的药品字典表",httpMethod = "post", response = String.class)
    public  R fundDrugs(Integer currentPage,Integer pageSize){

        return drugService.fundDrugs(currentPage,pageSize);
    }
    //   1.4.2：添加药品字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/addDrugs",method = RequestMethod.POST)
    @ApiOperation(value = "添加药品字典表的接口",notes = "添加药品字典表",httpMethod = "post", response = String.class)
    public  R addDrugs(@RequestBody @ApiParam(name = "实体类",value = "drugTable") DrugTableVo drugTable){

        return drugService.addDrugs(drugTable);
    }
    // 1.4.3：编辑药品字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/editDrugs",method = RequestMethod.POST)
    @ApiOperation(value = "编辑药品字典表的接口",notes = "编辑药品字典表",httpMethod = "post", response = String.class)
    public  R editDrugs(@RequestBody @ApiParam(name = "实体类",value = "drugTable") DrugTableVo drugTable){

        return drugService.editDrugs(drugTable);
    }
    // 1.4.4：删除药品字典表的接口：
    @ResponseBody
    @RequestMapping(value ="/deltDrugs",method = RequestMethod.POST)
    @ApiOperation(value = "删除药品字典表的接口",notes = "删除药品字典表",httpMethod = "post", response = String.class)
    @ApiImplicitParam(name = "id",value = "主键id",required = true,dataType = "int",paramType = "query")
    public  R delDrugs(@RequestParam(name = "id")Integer id){

        return drugService.delDrugs(id);
    }
}
